import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";

@Injectable()
export class MessageDetailProvider {
    private url = '/message/v1/app/one';
    public msgUrl='/favorite/v1/msg_favorite';

    constructor(public http: HttpClient) {
    }

    // 获取消息详情
    getMessageDetail(id):Observable<any>{
        return this.http.get(this.url+'?messageId='+id);
    }

    // 收藏资讯
    collectInfo(contentId):Observable<any>{
        return this.http.post(this.msgUrl+'/'+contentId,{},{responseType: "text"});
    }

    // 取消收藏
    cancelCollect(contentId):Observable<any>{
        return this.http.delete(this.msgUrl+'/'+contentId,{responseType: "text"});
    }

}
